package com.lagou.edu.wwyan.nacos.code.controller;

import com.lagou.edu.wwyan.nacos.code.service.LagouAuthCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("code")
public class LagouAuthCodeController {
    @Autowired
    private LagouAuthCodeService codeService;
    @GetMapping("create/{email}")
    public Boolean create(@PathVariable String email){
        return codeService.createAndSend(email);
    }
    @GetMapping("validate/{email}/{code}")
    public Integer validate(@PathVariable String email,@PathVariable String code){
        return codeService.validate(email,code);
    }
}
